﻿using System;
using System.Collections.Generic;
using UnityEngine;

// Token: 0x020002A0 RID: 672
public abstract class Projectile : MonoBehaviour
{
	// Token: 0x06000F0A RID: 3850 RVA: 0x0007315A File Offset: 0x0007135A
	protected virtual void Start()
	{
		this.alive = true;
	}

	// Token: 0x06000F0B RID: 3851 RVA: 0x00073164 File Offset: 0x00071364
	protected void OnTriggerEnter(Collider collider)
	{
		if (!this.alive)
		{
			return;
		}
		GameObject gameObject = collider.gameObject;
		if ((this.mask.value & 1 << gameObject.layer) != 1 << gameObject.layer)
		{
			return;
		}
		if (gameObject.layer == Layers.gtsBodyLayer)
		{
			GiantessBone component = gameObject.GetComponent<GiantessBone>();
			gameObject = component.giantess.gameObject;
		}
		else if (gameObject.layer == Layers.objectLayer)
		{
			GiantessBone component2 = gameObject.GetComponent<GiantessBone>();
			if (component2 != null)
			{
				gameObject = component2.giantess.gameObject;
			}
			else
			{
				gameObject = gameObject.transform.parent.gameObject;
			}
		}
		this.Impact(gameObject);
	}

	// Token: 0x06000F0C RID: 3852
	protected abstract void Impact(GameObject hitObject);

	// Token: 0x06000F0D RID: 3853
	protected abstract void SetColor(Color color, float emissionModifier = 1f);

	// Token: 0x06000F0E RID: 3854 RVA: 0x00073220 File Offset: 0x00071420
	public void SetSoundClip(AudioClip clip)
	{
		this.audioSource.clip = clip;
	}

	// Token: 0x06000F0F RID: 3855 RVA: 0x00073230 File Offset: 0x00071430
	protected void SetupAILayerMask()
	{
		List<string> list = new List<string>();
		list.Add(LayerMask.LayerToName(Layers.mapLayer));
		if (GlobalPreferences.AIProjectileGtsMask.value)
		{
			list.Add(LayerMask.LayerToName(Layers.gtsBodyLayer));
		}
		if (GlobalPreferences.AIProjectileMicroMask.value)
		{
			list.Add(LayerMask.LayerToName(Layers.microLayer));
		}
		if (GlobalPreferences.AIProjectileObjectMask.value)
		{
			list.Add(LayerMask.LayerToName(Layers.objectLayer));
		}
		if (GlobalPreferences.AIProjectilePlayerMask.value)
		{
			list.Add(LayerMask.LayerToName(Layers.playerLayer));
		}
		this.mask = LayerMask.GetMask(list.ToArray());
	}

	// Token: 0x04001400 RID: 5120
	protected float baseSpeed = 20f;

	// Token: 0x04001401 RID: 5121
	protected bool alive;

	// Token: 0x04001402 RID: 5122
	protected LayerMask mask;

	// Token: 0x04001403 RID: 5123
	protected Color mainColor;

	// Token: 0x04001404 RID: 5124
	protected float lifeTime;

	// Token: 0x04001405 RID: 5125
	[SerializeField]
	protected AudioSource audioSource;
}
